package com.carb.controller.admin;

import com.carb.result.Result;
import com.carb.service.WorkSpaceService;
import com.carb.vo.BusinessDataVO;
import com.carb.vo.BusinessStatusDataVO;
import com.carb.vo.ItemStatusDataVO;
import com.carb.vo.ProjectStatusDataVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 工作台 前端控制器
 * </p>
 *
 * @author XuChaoyang
 * @since 2025-02-12
 */
@RestController("adminWorkSpaceController")
@RequestMapping("/admin/workspace")
@Tag(name = "工作台相关接口")
@Slf4j
public class WorkSpaceController {

    @Resource
    private WorkSpaceService workSpaceService;

    /**
     * 今日业务数据查询
     * @return 今日业务数据VO
     */
    @GetMapping("/businessData")
    @Operation(summary = "今日业务数据查询")
    public Result<BusinessDataVO> getBusinessData() {
        log.info("今日业务数据查询");
        BusinessDataVO businessDataVO = workSpaceService.getBusinessData();
        log.info("今日业务数据查询成功！");
        return Result.success(businessDataVO);
    }

    /**
     * 今日业务状态数据查询
     * @return 今日业务状态数据VO
     */
    @GetMapping("/businessStatusData")
    @Operation(summary = "今日业务状态数据查询")
    public Result<BusinessStatusDataVO> getBusinessStatusData() {
        log.info("今日业务状态数据查询");
        BusinessStatusDataVO businessStatusDataVO= workSpaceService.getBusinessStatusData();
        log.info("今日业务状态数据查询成功！");
        return Result.success(businessStatusDataVO);
    }

    /**
     * 服务项目状态数据查询
     * @return 服务项目状态数据VO
     */
    @GetMapping("/projectStatusData")
    @Operation(summary = "服务项目状态数据查询")
    public Result<ProjectStatusDataVO> getProjectStatusData() {
        log.info("服务项目状态数据查询");
        ProjectStatusDataVO projectStatusDataVO = workSpaceService.getProjectStatusData();
        log.info("服务项目状态数据查询成功！");
        return Result.success(projectStatusDataVO);
    }

    /**
     * 物品状态数据查询
     * @return 物品状态数据VO
     */
    @GetMapping("/itemStatusData")
    @Operation(summary = "物品状态数据查询")
    public Result<ItemStatusDataVO> getItemStatusData() {
        log.info("物品状态数据查询");
        ItemStatusDataVO itemStatusData = workSpaceService.getItemStatusData();
        log.info("物品状态数据查询成功！");
        return Result.success(itemStatusData);
    }

}
